import type { DepartData, OrderDetail, OrderIdParams, orderParams, OrderPreData, OrderPreParams, PayParams, payResultData, UploadImage } from '@/type/consult'
import request from '@/utils/request'

// 获取全部科室列表
export const getDepListAPI = () => {
  return request.get<null, DepartData[]>('/dep/all')
}

// 获取图片的路径
export const getUploadAPI = (filePath: string) => {
  return request.upload<null, UploadImage>('/upload', {
    filePath,
    name: 'file',
  })
}

/** 预支付订单信息 */
export const getpreOrderAPI = (params:OrderPreParams) => {
  return request.get<null, OrderPreData>('/patient/consult/order/pre',{params})
}

//
/** 支付订单信息 */
export const orderPayAPI = (data:orderParams) => {
  return request.post<null, OrderIdParams>('/patient/consult/order',data)
}

/**
 * 三方支付（暂时只支持支付宝支付）
 */
export const goOrderPayAPI = (data:PayParams) => {
  return request.post<null, payResultData>('/patient/consult/pay',data)
}

/**
 * 问诊订单详情
 */
export const orderDetailAPI = (orderId: string) => {
  return request.get<null, OrderDetail>('/patient/consult/order/detail', { params: { orderId } })
}